DJPEG(1) DJPEG(1) NAME djpeg−decompressaJPEGfiletoanimagefile SYNOPSIS djpeg[options][filename] DESCRIPTION djpegdecompressesthenamedJPEGfile,orthestandardinputifnofileisnamed,andproduces animagefileonthestandardoutput.PBMPLUS(PPM/PGM),BMP,GIF,Targa,orRLE (UtahRasterToolkit)outputformatcanbeselected.(RLEissupportedonlyiftheURTlibrary isavailable.) OPTIONS Allswitchnamesmaybeabbreviated;forexample,−grayscalemaybewritten−grayor−gr. Mostofthe"basic"switchescanbeabbreviatedtoaslittleasoneletter.Upperandlowercase areequivalent(thus−GIFisthesameas−gif).Britishspellingsarealsoaccepted(e.g., −greyscale),thoughforbrevitythesearenotmentionedbelow. Thebasicswitchesare: −colorsN ReduceimagetoatmostNcolors.Thisreducesthenumberofcolorsusedintheoutput image,sothatitcanbedisplayedonacolormappeddisplayorstoredinacolormapped fileformat.Forexample,ifyouhavean8-bitdisplay,you’dneedtoreduceto256or fewercolors. −quantizeN Sameas−colors.−colorsistherecommendedname,−quantizeisprovidedonlyfor backwardscompatibility. −fastSelectrecommendedprocessingoptionsforfast,lowqualityoutput.(Thedefaultoptions arechosenforhighestqualityoutput.)Currently,thisisequivalentto−dctfast−nosmooth−onepass−ditherordered. −grayscale Forcegray-scaleoutputevenifJPEGfileiscolor.Usefulforviewingonmonochromedis-plays;also,djpegrunsnoticeablyfasterinthismode. −scaleM/N ScaletheoutputimagebyafactorM/N.Currentlythescalefactormustbe1/1,1/2, 1/4,or1/8.Scalingishandyiftheimageislargerthanyourscreen;also,djpegruns muchfasterwhenscalingdowntheoutput. −bmpSelectBMPoutputformat(Windowsflavor).8-bitcolormappedformatisemittedif −colorsor−grayscaleisspecified,oriftheJPEGfileisgray-scale;otherwise,24-bit full-colorformatisemitted. −gifSelectGIFoutputformat.SinceGIFdoesnotsupportmorethan256colors,−colors 256isassumed(unlessyouspecifyasmallernumberofcolors). −os2SelectBMPoutputformat(OS/21.xflavor).8-bitcolormappedformatisemittedif −colorsor−grayscaleisspecified,oriftheJPEGfileisgray-scale;otherwise,24-bit full-colorformatisemitted. −pnmSelectPBMPLUS(PPM/PGM)outputformat(thisisthedefaultformat).PGMisemittediftheJPEGfileisgray-scaleorif−grayscaleisspecified;otherwisePPMisemitted. −rleSelectRLEoutputformat.(RequiresURTlibrary.) −targa SelectTargaoutputformat.Gray-scaleformatisemittediftheJPEGfileisgray-scaleor if−grayscaleisspecified;otherwise,colormappedformatisemittedif−colorsisspecified;otherwise,24-bitfull-colorformatisemitted. 15June1995 1 DJPEG(1) DJPEG(1) Switchesforadvancedusers: −dctint UseintegerDCTmethod(default). −dctfast UsefastintegerDCT(lessaccurate). −dctfloat Usefloating-pointDCTmethod.Thefloatmethodisveryslightlymoreaccuratethan theintmethod,butismuchslowerunlessyourmachinehasveryfastfloating-pointhard-ware.Alsonotethatresultsofthefloating-pointmethodmayvaryslightlyacross machines,whiletheintegermethodsshouldgivethesameresultseverywhere.Thefast integermethodismuchlessaccuratethantheothertwo. −ditherfs UseFloyd-Steinbergditheringincolorquantization. −ditherordered Useorderedditheringincolorquantization. −dithernone Donotuseditheringincolorquantization.Bydefault,Floyd-Steinbergditheringis appliedwhenquantizingcolors;thisisslowbutusuallyproducesthebestresults. Orderedditherisacompromisebetweenspeedandquality;noditheringisfastbutusuallylooksawful.Notethattheseswitcheshavenoeffectunlesscolorquantizationisbeing done.Orderedditherisonlyavailablein−onepassmode. −mapfile Quantizetothecolorsusedinthespecifiedimagefile.Thisisusefulforproducingmultiplefileswithidenticalcolormaps,orforforcingapredefinedsetofcolorstobeused.The filemustbeaGIForPPMfile.Thisoptionoverrides−colorsand−onepass. −nosmooth Useafaster,lower-qualityupsamplingroutine. −onepass Useone-passinsteadoftwo-passcolorquantization.Theone-passmethodisfasterand needslessmemory,butitproducesalower-qualityimage.−onepassisignoredunless youalsosay−colorsN.Also,theone-passmethodisalwaysusedforgray-scaleoutput (thetwo-passmethodisnoimprovementthen). −maxmemoryN Setlimitforamountofmemorytouseinprocessinglargeimages.Valueisinthousands ofbytes,ormillionsofbytesif"M"isattachedtothenumber.Forexample,−max4m selects4000000bytes.Ifmorespaceisneeded,temporaryfileswillbeused. −outfilename Sendoutputimagetothenamedfile,nottostandardoutput. −verbose Enabledebugprintout.More−v’sgivemoreoutput.Also,versioninformationisprinted atstartup. −debug Sameas−verbose. EXAMPLES ThisexampledecompressestheJPEGfilefoo.jpg,automaticallyquantizesto256colors,andsaves theoutputinGIFformatinfoo.gif: djpeg−giffoo.jpg>foo.gif 15June1995 2 DJPEG(1) DJPEG(1) HINTS Togetaquickpreviewofanimage,usethe−grayscaleand/or−scaleswitches.−grayscale −scale1/8isthefastestcase. Severaloptionsareavailablethattradeoffimagequalitytogainspeed.−fastturnsontherecommendedsettings. −dctfastand/or−nosmoothgainspeedatasmallsacrificeinquality.Whenproducinga color-quantizedimage,−onepass−ditherorderedisfastbutmuchlowerqualitythanthe defaultbehavior.−dithernonemaygiveacceptableresultsintwo-passmode,butisseldomtol-erableinone-passmode. Ifyouarefortunateenoughtohaveveryfastfloatingpointhardware,−dctfloatmaybeeven fasterthan−dctfast.Butonmostmachines−dctfloatisslowerthan−dctint;inthiscaseit isnotworthusing,becauseitstheoreticalaccuracyadvantageistoosmalltobesignificantin practice. ENVIRONMENT JPEGMEM Ifthisenvironmentvariableisset,itsvalueisthedefaultmemorylimit.Thevalueis specifiedasdescribedforthe−maxmemoryswitch.JPEGMEMoverridesthedefault valuespecifiedwhentheprogramwascompiled,anditselfisoverriddenbyanexplicit −maxmemory. SEEALSO cjpeg(1),jpegtran(1),rdjpgcom(1),wrjpgcom(1) ppm(5),pgm(5) Wallace,GregoryK."TheJPEGStillPictureCompressionStandard",Communicationsofthe ACM,April1991(vol.34,no.4),pp.30-44. AUTHOR IndependentJPEGGroup BUGS Arithmeticcodingisnotsupportedforlegalreasons. Stillnotasfastaswe’dlike. 15June1995 3